<template>
  <el-dialog
    :title="plugin.lang('voucher.log.title')"
    v-model="show"
    :width="900"
  >
    <el-table :data="list" style="width: 100%;">
      <el-table-column :label="plugin.lang('voucher.log.checkout_name')" prop="checkout_name" min-width="150" />
      <el-table-column :label="plugin.lang('voucher.log.account_name')" prop="account_name" min-width="150" />
      <el-table-column :label="plugin.lang('voucher.log.type')" align="center">
        <template #default="scope">
          <el-tag :type="scope.row.type ? 'warning' : ''" >{{ plugin.langTm('voucher.log.type_text')[scope.row.type] }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column :label="plugin.lang('voucher.log.remarks')" prop="remarks" min-width="200" />
      <el-table-column :label="plugin.lang('voucher.log.time')" align="right" width="150">
        <template #default="scope">
          {{ time.format(scope.row.created_at) }}
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>
<script>
import { ref } from 'vue'
import app from '@/app'

export default {
  setup() {
    // 对话框
    const show = ref(false)

    // 列表
    const list = ref([])

    // 打开
    const open = data => {
      show.value = true
      list.value = data
    }

    return {
      time: app.time,
      money: app.money,
      plugin: app.plugin.index,
      show,
      open,
      list
    }
  }
}
</script>